HA$PBExportHeader$w_arg_rep_kardex_resumen.srw
forward
global type w_arg_rep_kardex_resumen from w_arg_report
end type
type st_1 from statictext within w_arg_rep_kardex_resumen
end type
type st_2 from statictext within w_arg_rep_kardex_resumen
end type
type dp_fini from datepicker within w_arg_rep_kardex_resumen
end type
type st_3 from statictext within w_arg_rep_kardex_resumen
end type
type st_4 from statictext within w_arg_rep_kardex_resumen
end type
type dp_ffin from datepicker within w_arg_rep_kardex_resumen
end type
type ddlb_almacen from uo_middlb within w_arg_rep_kardex_resumen
end type
type ddlb_item from uo_middlb within w_arg_rep_kardex_resumen
end type
type ddlb_transaccion from uo_middlb within w_arg_rep_kardex_resumen
end type
type st_5 from statictext within w_arg_rep_kardex_resumen
end type
type rb_1 from radiobutton within w_arg_rep_kardex_resumen
end type
type rb_2 from radiobutton within w_arg_rep_kardex_resumen
end type
type rb_3 from radiobutton within w_arg_rep_kardex_resumen
end type
type gb_1 from groupbox within w_arg_rep_kardex_resumen
end type
type gb_2 from groupbox within w_arg_rep_kardex_resumen
end type
end forward

global type w_arg_rep_kardex_resumen from w_arg_report
integer width = 2331
integer height = 1080
string title = "Reportes de Kardex Resumido"
integer transparency = 5
windowanimationstyle openanimation = centeranimation!
windowanimationstyle closeanimation = centeranimation!
st_1 st_1
st_2 st_2
dp_fini dp_fini
st_3 st_3
st_4 st_4
dp_ffin dp_ffin
ddlb_almacen ddlb_almacen
ddlb_item ddlb_item
ddlb_transaccion ddlb_transaccion
st_5 st_5
rb_1 rb_1
rb_2 rb_2
rb_3 rb_3
gb_1 gb_1
gb_2 gb_2
end type
global w_arg_rep_kardex_resumen w_arg_rep_kardex_resumen

type variables
string isa_alma[],is_alma,isa_item[],is_item,isa_trans[] ,is_trans

end variables

forward prototypes
public subroutine wf_ejecutar_reporte ()
end prototypes

public subroutine wf_ejecutar_reporte ();Datetime ldt_fecini,ldt_fecfin
String ls_titulo_fecha

ldt_fecini =datetime(date(dp_fini.text),time('00:00:00'))
ldt_fecfin = datetime(date(dp_ffin.text),time('23:59:59'))

choose case is_trans
	case '1'
		istr_parm.dw_parm[1].dataobject  = 'd_usp_represumenkardex'
	case '2'
		istr_parm.dw_parm[1].dataobject  = 'd_usp_represumenkardex_costo'
	case '3'
		istr_parm.dw_parm[1].dataobject  = 'd_usp_represumenkardex_cantcosto'
end choose
istr_parm.dw_parm[1].settransobject(sqlca)
istr_parm.dw_parm[1].Retrieve(istr_parm.integer_parm[1],istr_parm.integer_parm[2],integer(is_trans),ldt_fecini,ldt_fecfin)

ls_titulo_fecha = 'DESDE ' + STRING(ldt_fecini,'DD/MM/YYYY') + ' AL ' + STRING(ldt_fecfin,'DD/MM/YYYY HH:MM:SS')

istr_parm.dw_parm[1].object.t_titulo1.text =ls_titulo_fecha
end subroutine

on w_arg_rep_kardex_resumen.create
int iCurrent
call super::create
this.st_1=create st_1
this.st_2=create st_2
this.dp_fini=create dp_fini
this.st_3=create st_3
this.st_4=create st_4
this.dp_ffin=create dp_ffin
this.ddlb_almacen=create ddlb_almacen
this.ddlb_item=create ddlb_item
this.ddlb_transaccion=create ddlb_transaccion
this.st_5=create st_5
this.rb_1=create rb_1
this.rb_2=create rb_2
this.rb_3=create rb_3
this.gb_1=create gb_1
this.gb_2=create gb_2
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.st_1
this.Control[iCurrent+2]=this.st_2
this.Control[iCurrent+3]=this.dp_fini
this.Control[iCurrent+4]=this.st_3
this.Control[iCurrent+5]=this.st_4
this.Control[iCurrent+6]=this.dp_ffin
this.Control[iCurrent+7]=this.ddlb_almacen
this.Control[iCurrent+8]=this.ddlb_item
this.Control[iCurrent+9]=this.ddlb_transaccion
this.Control[iCurrent+10]=this.st_5
this.Control[iCurrent+11]=this.rb_1
this.Control[iCurrent+12]=this.rb_2
this.Control[iCurrent+13]=this.rb_3
this.Control[iCurrent+14]=this.gb_1
this.Control[iCurrent+15]=this.gb_2
end on

on w_arg_rep_kardex_resumen.destroy
call super::destroy
destroy(this.st_1)
destroy(this.st_2)
destroy(this.dp_fini)
destroy(this.st_3)
destroy(this.st_4)
destroy(this.dp_ffin)
destroy(this.ddlb_almacen)
destroy(this.ddlb_item)
destroy(this.ddlb_transaccion)
destroy(this.st_5)
destroy(this.rb_1)
destroy(this.rb_2)
destroy(this.rb_3)
destroy(this.gb_1)
destroy(this.gb_2)
end on

event open;call super::open;istr_parm.integer_parm[1]=0
istr_parm.integer_parm[2]=0
ddlb_almacen.selectitem( 1)
ddlb_item.selectitem( 1)
ddlb_transaccion.selectitem( 1)
is_trans='1'


end event

type cb_2 from w_arg_report`cb_2 within w_arg_rep_kardex_resumen
integer x = 1870
integer y = 836
end type

type cb_1 from w_arg_report`cb_1 within w_arg_rep_kardex_resumen
integer x = 1417
integer y = 832
end type

type dw_1 from w_arg_report`dw_1 within w_arg_rep_kardex_resumen
boolean visible = false
integer x = 105
integer y = 1088
integer width = 407
integer height = 112
end type

type st_1 from statictext within w_arg_rep_kardex_resumen
integer x = 82
integer y = 72
integer width = 329
integer height = 88
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Almacen:"
boolean focusrectangle = false
end type

type st_2 from statictext within w_arg_rep_kardex_resumen
integer x = 82
integer y = 196
integer width = 329
integer height = 88
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Item:"
boolean focusrectangle = false
end type

type dp_fini from datepicker within w_arg_rep_kardex_resumen
integer x = 558
integer y = 312
integer width = 594
integer height = 84
integer taborder = 50
boolean bringtotop = true
boolean border = true
borderstyle borderstyle = stylelowered!
date maxdate = Date("2999-12-31")
date mindate = Date("1800-01-01")
datetime value = DateTime(Date("2011-02-24"), Time("11:01:07.000000"))
integer textsize = -8
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
integer calendarfontweight = 400
boolean todaysection = true
boolean todaycircle = true
end type

type st_3 from statictext within w_arg_rep_kardex_resumen
integer x = 69
integer y = 324
integer width = 379
integer height = 88
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Fecha Inicial:"
boolean focusrectangle = false
end type

type st_4 from statictext within w_arg_rep_kardex_resumen
integer x = 82
integer y = 444
integer width = 334
integer height = 88
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Fecha Final:"
boolean focusrectangle = false
end type

type dp_ffin from datepicker within w_arg_rep_kardex_resumen
integer x = 562
integer y = 444
integer width = 585
integer height = 80
integer taborder = 40
boolean bringtotop = true
boolean border = true
borderstyle borderstyle = stylelowered!
date maxdate = Date("2999-12-31")
date mindate = Date("1800-01-01")
datetime value = DateTime(Date("2011-02-24"), Time("11:01:07.000000"))
integer textsize = -8
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
integer calendarfontweight = 400
boolean todaysection = true
boolean todaycircle = true
end type

type ddlb_almacen from uo_middlb within w_arg_rep_kardex_resumen
integer x = 562
integer y = 64
integer width = 1659
boolean bringtotop = true
end type

event constructor;call super::constructor;ddlb_almacen.event ue_rellena('select idalma,tdesc from malmacen order by 1 asc')
end event

event selectionchanged;call super::selectionchanged;istr_parm.integer_parm[1]=integer(isa_alma[index] )

ddlb_item.reset( )
ddlb_item.event ue_rellena('select distinct a.iditem,i.tDescCorta from mitem i , mitemalma a where i.iditem = a.iditem and  a.idalma = case "'+string(istr_parm.integer_parm[1])+'" when 0 then a.idalma else   "'+string(istr_parm.integer_parm[1])+'"  end order by 2 asc')
end event

event ue_rellena;long ll_indice= 1
string ls_campo[]

setpointer(hourglass!)
isa_alma[ll_indice]=STRING(0)
is_columna2[ll_indice]='TODOS()'
this.additem(is_columna2[ll_indice])
ll_indice ++


prepare sqlsa from :as_cadena;
declare cur01 dynamic cursor for sqlsa;
open dynamic cur01 ;
fetch cur01 into :isa_alma[ll_indice], :is_columna2[ll_indice];
do while sqlca.sqlcode=0 
	this.additem(is_columna2[ll_indice])
	ll_indice++
	fetch cur01 into :isa_alma[ll_indice], :is_columna2[ll_indice];
loop
if sqlca.sqlcode = -1 then
   return -1
else
	close cur01 ;
	return 1
end if
setpointer(arrow!)




end event

type ddlb_item from uo_middlb within w_arg_rep_kardex_resumen
integer x = 562
integer y = 188
integer width = 1655
integer taborder = 20
boolean bringtotop = true
end type

event selectionchanged;call super::selectionchanged;istr_parm.integer_parm[2]=integer(isa_item[index] )
end event

event ue_rellena;


long ll_indice= 1


setpointer(hourglass!)
isa_item[ll_indice]=STRING(0)
is_columna2[ll_indice]='TODOS()'
this.additem(is_columna2[ll_indice])
ll_indice ++

prepare sqlsa from :as_cadena;
declare cur01 dynamic cursor for sqlsa;
open dynamic cur01 ;
fetch cur01 into :isa_item[ll_indice], :is_columna2[ll_indice];
do while sqlca.sqlcode=0 
	this.additem(is_columna2[ll_indice])
	ll_indice++
	fetch cur01 into :isa_item[ll_indice], :is_columna2[ll_indice];
loop
if sqlca.sqlcode = -1 then
   return -1
else
	close cur01 ;
	return 1
end if
setpointer(arrow!)




end event

event constructor;call super::constructor;ddlb_item.reset( )
ddlb_item.event ue_rellena('select distinct a.iditem,i.tDescCorta from mitem i , mitemalma a where i.iditem = a.iditem  order by 2 asc')
end event

type ddlb_transaccion from uo_middlb within w_arg_rep_kardex_resumen
integer x = 558
integer y = 1160
integer width = 1641
integer taborder = 30
boolean bringtotop = true
end type

event constructor;call super::constructor;//this.event ue_rellena('select idtrans,tdesc from mtipotrans order by 2 asc')
end event

event ue_rellena;long ll_indice= 1


setpointer(hourglass!)
isa_trans[ll_indice]=STRING(0)
is_columna2[ll_indice]='TODOS()'
this.additem(is_columna2[ll_indice])
ll_indice ++



prepare sqlsa from :as_cadena;
declare cur01 dynamic cursor for sqlsa;
open dynamic cur01 ;
fetch cur01 into :isa_trans[ll_indice], :is_columna2[ll_indice];
do while sqlca.sqlcode=0 
	this.additem(is_columna2[ll_indice])
	ll_indice++
	fetch cur01 into :isa_trans[ll_indice], :is_columna2[ll_indice];
loop
if sqlca.sqlcode = -1 then
   return -1
else
	close cur01 ;
	return 1
end if
setpointer(arrow!)



end event

event selectionchanged;call super::selectionchanged;is_trans= isa_trans[index]
end event

type st_5 from statictext within w_arg_rep_kardex_resumen
integer y = 1240
integer width = 539
integer height = 88
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Tipo de Transacci$$HEX1$$f300$$ENDHEX$$n:"
boolean focusrectangle = false
end type

type rb_1 from radiobutton within w_arg_rep_kardex_resumen
integer x = 114
integer y = 684
integer width = 489
integer height = 72
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "Solo Cantidades"
boolean checked = true
end type

event clicked;is_trans='1'
end event

type rb_2 from radiobutton within w_arg_rep_kardex_resumen
integer x = 800
integer y = 680
integer width = 480
integer height = 72
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "Solo Costo"
end type

event clicked;is_trans='2'
end event

type rb_3 from radiobutton within w_arg_rep_kardex_resumen
integer x = 1413
integer y = 684
integer width = 343
integer height = 72
boolean bringtotop = true
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "Ambos"
end type

event clicked;is_trans='3'
end event

type gb_1 from groupbox within w_arg_rep_kardex_resumen
integer x = 46
integer y = 608
integer width = 2235
integer height = 176
integer taborder = 50
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "Ver:"
end type

type gb_2 from groupbox within w_arg_rep_kardex_resumen
integer x = 32
integer width = 2249
integer height = 592
integer taborder = 60
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
end type

